package com.easyioc.util;

import java.io.File;
import java.net.URL;

import com.easyioc.ResourceAccessException;

public class FileUtils {
	public static File loadClassPathFile(String filePath) {
		URL fileUrl = Thread.currentThread().getContextClassLoader()
				.getResource(filePath);
		File file = new File(fileUrl.getFile());
		if (!file.exists()) {
			throw new ResourceAccessException("Can not load the file [ "
					+ fileUrl.getPath() + " ]");
		}
		return file;
	}
}
